// import { createApp, h, provide } from 'vue';  // 直接使用根目录的 vue
import { createApp, provide } from "vue"; // 直接使用根目录的 vue
import router from "./router";
// import { setupStore,store } from "@/store";
import { createPinia, Pinia } from 'pinia'; // 导入Pinia及类型
import "@/assets/styles/root.scss";
import "./assets/styles/global.scss";
import "virtual:svg-icons-register";
import App from "./App.vue";
import "element-plus/dist/index.css";

// 引入组件
import XcForm from '@xc-components/xc-form';
import XcTable from '@xc-components/xc-table';

import zhCn from "element-plus/es/locale/lang/zh-cn";
import ElementPlus from "element-plus";
// 导入平台组件暴露模块
import '@/platform-components';

const app = createApp(App);
// setupStore(app);

const pinia = createPinia();

// 3. 注册Pinia到Vue应用（关键：让Vue实例关联Pinia）
app.use(pinia);

provide("iconPrefix", "i");

app.use(router);

app.use(ElementPlus, { locale: zhCn });

app.component('XcForm', XcForm);
app.component('XcTable', XcTable);

app.mount("#app");


declare global {
  interface Window {
    vueApp: ReturnType<typeof createApp>; // Vue实例
    Pinia: Pinia; // Pinia实例
  }
}
window.vueApp = app;
window.Pinia = pinia;